﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;
using Brush = System.Windows.Media.Brush;

namespace HeightControlAssistanceProgram.ConvertHelper
{
    
    internal class BackgroundColor_For_DoorIsOpen_MultiValueConvertHelper : IMultiValueConverter
    {

        Brush brush_DoorNotOpen = new SolidColorBrush(Colors.DarkGray);
        Brush brush_DoorOpen = new SolidColorBrush(Colors.Gold);
        Brush brush_DoorNotOpenAt = new SolidColorBrush(Colors.Wheat);//2025年11月13日11:28:33 新增，当电梯未开门但在指定楼层时的颜色
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {

            //values[0] 电梯所在楼层  values[1] 是否开门  values[2] 楼层数据，需要对比的内容

            if (values[1] is bool)
            {
                if (values[0].ToString() == values[2].ToString()) //2025年11月13日11:28:48之前开门不变色，现在找到问题了。
                {
                    if ((bool)values[1])
                    {
                        return brush_DoorOpen;
                    }
                    else
                    {
                        return brush_DoorNotOpenAt;
                    }
                }
                else
                {
                    return brush_DoorNotOpen;
                }
                
            }
            return brush_DoorOpen;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
